#ifndef QILISUBTITLES_H
#define QILISUBTITLES_H

#include "QiliWidget.h"

#include <QGraphicsView>
#include <QGraphicsScene>
#include <QList>
#include <QGraphicsItem>

class QiliSubtitleBlock;

class QiliSubtitles : public QiliDialog
{
public:
    explicit QiliSubtitles(QWidget *parent = nullptr);

public slots:
    void subtitleReceived(const QString &username, const QString &avatar, const QString &subtitle, const QJsonObject &emots);
    void likeClicked(const QString &username, const QString &avatar, const QString &words);
    void userEntered(const QString &username, const QString &avatar, const QString &welcome);

private:
    void buildBlock(const QString &username, const QString &avatar, const QString &text);

    QGraphicsScene *mScene;
    QGraphicsView  *mView;
    QList<QiliSubtitleBlock *> mBlocks{};
    int mOffset;
    int mHeight;
};

#endif // QILISUBTITLES_H
